/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Business;

import java.util.ArrayList;
import java.util.Date;
import javax.swing.JComboBox;
import tuitionmanagement.DAO.OrderDao;
import tuitionmanagement.entity.OrderEntity;

/**
 *
 * @author XUAN
 */
public class OrderBuss {

    OrderDao ordao = new OrderDao();
    private String lastError;

    public boolean update(OrderEntity or) {
        return ordao.update(or);
    }

    public ArrayList<OrderEntity> getOrderByDate(Date searchFrom, Date searchTo) {
        return ordao.getOrderByDate(searchFrom, searchTo);
    }

    public void getcmbInvoiceId(JComboBox cmbInvoiceId, String invoiceId) {
//        return ordao.getcmbInvoiceId(cmbInvoiceId, invoiceId);
    }

    public ArrayList<OrderEntity> readByAll() {
        return ordao.readByAll();
    }

    public boolean addOrder(OrderEntity order) {
        return ordao.addOrder(order);
    }

    public boolean delete(int OrderId) {
        return ordao.deleteOrder(OrderId);
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }

    public ArrayList<OrderEntity> getTableOrder(int invoiceId) {
        return ordao.getTableOrder(invoiceId);
    }

    public ArrayList<OrderEntity> getTableOrderByOrderId(int invoiceId, int orderId) {
        return ordao.getTableOrderByOrderId(invoiceId,orderId);
    }
}
